package com.itheima.feign.clients;

import com.itheima.feign.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient("user-service")
public interface UserClient {
    @GetMapping("/user/{id}")
    User findById(@PathVariable("id") Long id);

    /**
     * 需要指定参数到底是什么格式的
     * java.lang.IllegalStateException: Method has too many Body parameters:
     * public abstract com.itheima.feign.pojo.User com.itheima.feign.clients.UserClient.getUser(java.lang.Long,java.lang.String)
     * @param id
     * @param name
     * @return
     */
    @GetMapping("/user/getuser")
    String getUser(@RequestParam("id") Long id, @RequestParam("name") String name);
}